import random
import time
# 数据生成器
# 定义验证码可能存在的字符串
captcha_array=list("0123456789abcdefghijklmnopqrstuvwxyz")
# 生成的验证码长度
captcha_size=4
from captcha.image import ImageCaptcha
if __name__ == '__main__':
    for i in range(500):
        image=ImageCaptcha()
        image_text="".join(random.sample(captcha_array,captcha_size))
        image_path="./datasets/train/{}_{}.png".format(image_text,int(time.time()))
        image.write(image_text,image_path)